import React from 'react';
import './style/index.scss';

interface ButtonProps {
  children: React.ReactNode;
  type?: 'primary' | 'success' | 'warning' | 'danger';
  onClick?: () => void;
  className?: string;
  disabled?: boolean;
  size?: 'small' | 'medium' | 'large';
  plain?: boolean;
}

const Button: React.FC<ButtonProps> = (props) => {
  const {
    children,
    type = 'default',
    size = 'medium',
    className = '',
    onClick,
    disabled,
    plain = false,
  } = props;
  return (
    <button
      type="button"
      className={`zfast-button zfast-button-${type} zfast-button-${size} ${className} ${
        plain ? `zfast-button-plain-${type}` : ''
      } ${disabled ? 'zfast-button-disabled' : ''}`}
      onClick={onClick}
      disabled={disabled}
    >
      {children}
    </button>
  );
};

export default Button;
